package com.sinosoft.bee.services.proposal.controller;

import com.sinosoft.bee.services.proposal.entity.proposal.ProposalAppnt;
import com.sinosoft.bee.services.proposal.entity.proposal.ProposalInsured;
import com.sinosoft.bee.services.proposal.entity.proposal.ProposalMain;
import com.sinosoft.bee.services.proposal.entity.proposal.ProposalProduct;
import com.sinosoft.bee.services.proposal.service.ProposalMainService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: TrickerL
 * @Description: bee
 * @Date: Create in 15:31 2018/5/21
 * @Modified By:
 */
@RestController(value = "/order/proposal")
public class ProposalController {
    @Qualifier
    private ProposalMainService proposalMainService;

    @GetMapping("/get")
    public List<ProposalMain> get(){
        return proposalMainService.selectAllMain();
    }

//    @GetMapping("/prem/{prem}")
//    public String getAmnt(@PathVariable double prem){
//        return null;
//    }
//
//    @GetMapping("/amnt/{amnt}")
//    public String getPrem(@PathVariable double amnt){
//        return null;
//    }
//
//    @GetMapping("/notice/{riskcode}")
//    public String getNotice(@PathVariable String riskcode){
//        return null;
//    }
//
    @RequestMapping(value = "/post",method = RequestMethod.POST)
    public void post(@RequestBody @Valid ProposalAppnt proposalAppnt,
                     @RequestBody @Valid ProposalInsured[] proposalInsureds,
                     @RequestBody @Valid ProposalMain proposalMain,
                     @RequestBody @Valid ProposalProduct[] proposalProducts){
        System.out.println(proposalAppnt);
        System.out.println(proposalMain);
        for (ProposalInsured proposalInsured:proposalInsureds
             ) {
            System.out.println(proposalInsured);
        }
        for (ProposalProduct proposalProduct:proposalProducts
             ) {
            System.out.println(proposalProduct);
        }
    }
//
//
//    @RequestMapping(value = "/put",method = RequestMethod.PUT)
//    public String put(){
//        return null;
//    }
//
//    @RequestMapping(value = "/patch",method = RequestMethod.PATCH)
//    public String patch(){
//        return null;
//    }
//
//    @RequestMapping(value = "/delete/",method = RequestMethod.DELETE)
//    public String delete(@PathVariable String orderId){
//        try{
//            System.out.println("hello");
//        }catch (Exception e){
//
//        }
//        return null;
//    }

}
